package com.neusoft.yiyang.medical.service.impl;

import com.neusoft.yiyang.common.entity.medical.MedicalRecord;
import com.neusoft.yiyang.medical.mapper.MedicalRecordMapper;
import com.neusoft.yiyang.medical.service.MedicalRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

@Service
public class MedicalRecordServiceImpl implements MedicalRecordService {

    @Autowired
    private MedicalRecordMapper medicalRecordMapper;

    @Override
    public void createMedicalRecord(MedicalRecord medicalRecord) {
        medicalRecordMapper.insert(medicalRecord);
    }

    @Override
    public List<MedicalRecord> getAllMedicalRecords() {
        return medicalRecordMapper.selectList(null);
    }

    @Override
    public List<MedicalRecord> getMedicalRecordsByCustomerId(Integer customerId) {
        return medicalRecordMapper.selectByCustomerId(customerId);
    }

    @Override
    public void updateMedicalRecord(MedicalRecord medicalRecord) {
        medicalRecordMapper.updateById(medicalRecord);
    }

    @Override
    public void deleteMedicalRecord(Integer medicalRecordId) {
        medicalRecordMapper.deleteById(medicalRecordId);
    }


}
